﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 水牛管理系统.UI {
    public partial class MainForm : Form {

        Color color;

        public MainForm() {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e) {
            loadForm(new VisitorManage());
            color = button1.BackColor;
        }

        public void loadForm(object form) {
            if (this.panel2.Controls.Count > 0)
                this.panel2.Controls.RemoveAt(0);
            Form f = form as Form;
            f.TopLevel = false;
            f.Dock = DockStyle.Fill;
            this.panel2.Controls.Add(f);
            this.panel2.Tag = f;
            f.Show();
        }

        public void resetAllWindows() {
            button1.BackColor = color;
            button3.BackColor = color;
            button4.BackColor = color;
        }

        private void button1_Click(object sender, EventArgs e) {
            resetAllWindows();
            button1.BackColor = Color.White;
            loadForm(new VisitorManage());
        }

        private void button3_Click(object sender, EventArgs e) {
            resetAllWindows();
            button3.BackColor = Color.White;
            loadForm(new Statistic());
        }

        private void button4_Click(object sender, EventArgs e) {
            resetAllWindows();
            button4.BackColor = Color.White;
            loadForm(new Record());
        }

        private void pictureBox1_Click(object sender, EventArgs e) {

        }
    }
}
